From: Florian Müllner Date: Wed, 3 Aug 2022 06:12:28 +0000 (+0200) Subject: status/network: Add timestamp property to items X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~461^2^2~84 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a3dbb3e71f719bf8346734249a27451fa734b8e2;p=gnome-shell.git status/network: Add timestamp property to items Connections have a timestamp property, which records the last time it was succesfully activated. This is useful information to us, as more recently used connections are likely more relevant than ones that haven't been used for a long time (or not at all). To make use of it in the future, expose that timestamp as a property. Only connections support it, but we will soon provide a reasonable value for devices as well, so add the property to the base class. Part-of: --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 7370af985..98e50dbee 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -161,6 +161,10 @@ const NMMenuItem = GObject.registerClass({ return this.state <= NM.ActiveConnectionState.ACTIVATED; } + get timestamp() { + return 0; + } + activate() { super.activate(Clutter.get_current_event()); } @@ -301,6 +305,10 @@ class NMConnectionItem extends NMMenuItem { return this._connection.get_id(); } + get timestamp() { + return this._connection.get_setting_connection()?.get_timestamp() ?? 0; + } + updateForConnection(connection) { // connection should always be the same object // (and object path) as this._connection, but